package aStar;

public class PathVector {
	
	private int dx;
	private int dy;
	private int dz;

	public PathVector() {
		this.dx = 0;
		this.dy = 0;
		this.dz = 0;
	}
	
	public PathVector(int dx, int dy, int dz) {
		this.dx = dx;
		this.dy = dy;
		this.dz = dz;
	}
	
	public PathVector(Tile origin, Tile destination) {
		this.dx = destination.tileX-origin.tileX;
		this.dy = destination.tileY-origin.tileY;
		
		this.dz = destination.tileHight-origin.tileHight;
	}
	
	public int getdx() {
		return dx;
	}

	public int getdy() {
		return dy;
	}
	
	public int getdz() {
		return dz;
	}
	
	public int[] getVector() {
		int[] array = {dx, dy, dz};
		return array;
	}
	
	public void setdx(int dx) {
		this.dx = dx;
	}
	
	public void setdy(int dy) {
		this.dy = dy;
	}
	
	public void setdz(int dz) {
		this.dz = dz;
	}
	
	public void setVector(int[] array) {
		if (array.length != 3) {
			System.err.println("ERROR: INVALID ARRAY PASSED TO SET_VECTOR");
			System.exit(0);
		}
		this.dx = array[0];
		this.dy = array[1];
		this.dz = array[2];
	}
	
	@Override
	public String toString() {
		return ("VECTOR=:<"+dx+";"+dy+";"+dz+">");
	}
	
	public boolean equalDirection(PathVector vector) {
		if(this.dx == vector.dx && this.dy == vector.dy)
			return true;
		return false;
	}
	
	public void invertDirection() {
		this.dx = -this.dx;
		this.dy = -this.dy;
		this.dz = -this.dz;
	}
	
}
